/*
 * @Author: wuyang
 * @Description: 
 * @Date: 2023-01-10 15:28:08
 * @LastEditors: wuyang
 * @LastEditTime: 2023-01-13 14:45:41
 * @FilePath: \vue-ts-vite\src\store\modules\system.ts
 */
// 用户相关 - 状态管理数据
import { store } from "@/store";
import { defineStore } from "pinia";

const useSystemStore = defineStore({
  id: "vitality-system",
  state: () => {
    return {
      // sidebar 是否折叠
      collapse: false,
      // tabs 标签页数据
      tabsList: [{
        name: '首页',
        path: '/manage/home'
      }],
      /**
       *  布局方式:
       *  vertical    左侧
       *  horizontal  顶部
       *  mix         混合
       *  默认值：vertical(导航栏在左侧)
       */
      layoutMethods: sessionStorage.getItem("layoutMethods") || "vertical"
    };
  },

  getters: {},

  actions: {
    /** 修改collapse数据 */
    SET_COLLAPSE() {
      this.collapse = !this.collapse;
    },
    /** 删除tags标签页数据 */
    SET_TABSLIST(value: number) {
      this.tabsList.splice(value, 1)
    },
    /** 修改布局方式数据 */
    SET_LAYOUTMETHODS(value: string) {
      this.layoutMethods = value
    }
  },
});

export default useSystemStore;
export function useSystemStoreHook() {
  return useSystemStore(store);
}
